<script type="text/javascript"> 
      $(document).ready(function(){
      	$("ul.tabs").tabs("div.panes > div");
	    });
</script>

<script language="javascript">
var xmlHttp

function showKab(str)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	var url="<?php echo site_url().'account/ajax_showKab'?>";
	
	url=url+"/"+str;
	//url=url+"&sid="+Math.random();
	

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
//alert(document.getElementById("txtHint").innerHTML);
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
</script> 
<script type="text/javascript">
		$(document).ready(function() {
			$("#form_pass").validate({
			
				rules: {
						old_pass: 
						{
							required: true
						},		
					    new_pass: 
						{
							required: true,
							minlength: 5
						},		
					    new_pass_conf:
						{
							required: true,
							equalTo: "#new_pass"
						}
				},
			errorClass: "sss",
      	messages: 
				{ 
					old_pass: {
						required: 'Password lama harus diisi'
					},
					new_pass: {
						required : 'Password harus di isi',
						minlength: 'Password minimal 5 karakter'
					},
					new_pass_conf: {
						required: 'Ulangi Password harus di isi',
						equalTo : 'Password tidak sama'
					}
				},
         
         success: function(label) {
            label.text('OK!').addClass('valid');
         }
			});
		});
	</script>
<div class="left_konten">
<div class="breadcumbs"><?php echo $cumb;?></div>                      
<h2>Edit Account</h2>

<div id="demo" class="demolayout">
	<ul class="tabs">
		<li><a class="current" href="#">Detail Akun</a></li>
		<li><a class="" href="#">Ganti Password</a></li>
		<li><a class="" href="#">Order Histori</a></li>
	</ul>

<!-- panes (content untuk masing-masing tab) -->
	<div class="panes">
		<div style="display: block;">
			<form action="" method="post" onsubmit="return check();">
			<div class="form_row">
				<label class="contact"><strong>Nama:</strong></label>
				<?php echo form_error('nama', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="nama" value="<?php echo $acc->nama; ?>">
			</div> 

			<div class="form_row">
				<label class="contact"><strong>Jenis Kelamin:</strong></label>
				<?php echo form_error('jenkel', '<div class="error">', '</div>'); ?>
				<?php echo jenkelDropdown($acc->jenkel);?>
			</div> 
			
			<div class="form_row">
				<label class="contact"><strong>Email:</strong></label>
				<?php echo form_error('email', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="email" value="<?php echo $acc->email; ?>">
			</div>

			<div class="form_row">
				<label class="contact"><strong>Telepon:</strong></label>
				<?php echo form_error('telp', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="telp" value="<?php echo $acc->telp; ?>">
			</div>

			<div class="form_row">
				<label class="contact"><strong>Mobile Phone/HP:</strong></label>
				<?php echo form_error('hp', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="hp" value="<?php echo $acc->hp; ?>">
			</div>

			<div class="form_row">
				<label class="contact"><strong>Alamat:</strong></label>
				<?php echo form_error('alamat', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="alamat" value="<?php echo $acc->alamat; ?>">
			</div> 

			<div class="form_row">
				<label class="contact"><strong>Propinsi:</strong></label>
				<?php echo form_error('prov_id', '<div class="error">', '</div>'); ?>
				<?php echo provDropdown($acc->mem_prov_id)?>
			</div> 

			<div  class="form_row">
				<label class="contact"><strong>Kabupaten:</strong></label>
				<?php echo form_error('kab_id', '<div class="error">', '</div>'); ?>
				<div id="txtHint">
					<?php echo kabDropdown($acc->mem_prov_id,$acc->mem_kab_id)?>
				</div>
			</div> 

			<div class="form_row">
				<label class="contact"><strong>Kota:</strong></label>
				<?php echo form_error('kota', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="kota" value="<?php echo $acc->kota; ?>">
			</div> 

			<div class="form_row">
				<label class="contact"><strong>Kode Pos:</strong></label>
				<?php echo form_error('kodepos', '<div class="error">', '</div>'); ?>
				<input type="text" class="contact_input" name="kodepos" value="<?php echo $acc->kodepos; ?>">
			</div> 

			
			<div class="form_row">
				<input type="submit" class="register" value="simpan" />
				<br />
			</div>   
		</form>     
		</div>
		
		<div style="display: none;">

		<form id="form_pass" action="<?php echo site_url()?>account/edit_pass" method="post" onsubmit="return check();">
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="shoppingTable">
		 <tbody>
		  <tr>
			<td width="20%"><strong>Password Lama</strong></td>
			<td width="80%">
			<?php echo form_error('old_pass', '<div class="error">', '</div>'); ?>
				<input type="password" class="contact_input" id="old_pass" name="old_pass" value="<?php echo set_value('old_pass'); ?>">
		  </tr>
		  <tr>
			<td><strong>Password Baru</strong></td>
			<td>
			<?php echo form_error('new_pass', '<div class="error">', '</div>'); ?>
				<input type="password" class="contact_input" id="new_pass" name="new_pass" value="<?php echo set_value('new_pass'); ?>">
			</td>
		  </tr>
		 <tr>
			<td><strong>Ulangi Password</strong></td>
			<td>
			<?php echo form_error('new_pass_conf', '<div class="error">', '</div>'); ?>
				<input type="password" class="contact_input" id="new_pass_conf" name="new_pass_conf" value="<?php echo set_value('new_pass_conf'); ?>">
			</td>
		  </tr>
		  <tr>
			<td width="20%">&nbsp;</td>
			<td> <input type="submit" class="" value="simpan" /></td>
		  </tr>
		</tbody>
		</table>
		</form>
		</div>
		
		<div style="display: none;">
			
			<div class="new_prod_box">
				 	<table border="0" cellpadding="0" cellspacing="0" class="shoppingTable">
					<tr class="cart_title">
						<td>Order Date</td>
						<td>Code</td>
						<td>Status</td>
						<td>Total</td>  
						<td>Detail</td>  
						
					</tr>
					<tr>
					<?php foreach($res as $row):;?>
						<tr>
							<td class="isi_tab"><?php echo formatDate($row['order_date'],'short1'); ?></td>
							<td class="isi_tab"><?php echo $row['order_code'];?></td>
							<td class="isi_tab"><?php echo $row['order_status'];?></td></td>
							<td class="isi_tab_numb"><?php echo formatHarga($row['total'], 'lengkap');?></td>
							<td class="isi_tab"><a href="#order<?php echo $row['order_id'];?>" rel="facebox">Detail</a></td>
						</tr>
					<?php endforeach; ?>   
					</tr>              
				</table>
			</div>
			<?php echo getOrderAccount($mem_id);?>
			
			<div class="clear"></div>
		</div>
	</div>
</div>
</div>

